package com.example.dagger2one.activity;

import android.content.Context;
import android.os.Bundle;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.dagger2one.R;
import com.example.dagger2one.compnotent.DaggerCommonComponent;
import com.example.dagger2one.model.ICommonView;
import com.example.dagger2one.model.User;
import com.example.dagger2one.module.CommonModule;
import com.example.dagger2one.persenter.RegisterPresenter;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @作者: njb
 * @时间: 2019/7/19 10:21
 * @描述:
 */
public class RegisterActivity extends AppCompatActivity implements ICommonView {

    @BindView(R.id.btn_register)
    Button btnRegister;
    @Inject
    RegisterPresenter presenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.bind(this);
        DaggerCommonComponent
                .builder()
                .commonModule(new CommonModule(this))
                .build()
                .Inject(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public Context getContext() {
        return this;
    }

    @OnClick(R.id.btn_register)
    public void onViewClicked() {
        presenter.register(new User());
    }
}
